package com.qfedu.food.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qfedu.food.dao.ThomeLifeDao;
import com.qfedu.food.dto.PageDto;
import com.qfedu.food.pojo.ThomeLife;
import com.qfedu.food.service.intf.ThomeLifeService;
import com.qfedu.food.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author:生命因你而火热
 * @date: 2021/1/11 20:57
 */
@Service
public class ThomeLifeServiceImpl  implements ThomeLifeService {
    @Autowired
    private ThomeLifeDao thomeLifeDao;
    @Override
    public R queryAll() {
        return R.ok(thomeLifeDao.selectAll());
    }

    @Override
    public R selectByPage(PageDto dto) {
        String msg = dto.getMsg();
        if(msg!=null && msg.length()>0){
            msg="%"+msg+"%";
        }
        PageHelper.startPage(dto.getSize(),dto.getPage());
        return R.ok(thomeLifeDao.findByPage(msg));
    }

}

